define(
		["PDAppDir/properties", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar", "PDUtilDir/inputSelect", "PDUtilDir/fileupload/multiFileUpload" ],
		function(Properties, Util, Tool, Slidebar, inputSelect, MFU) {
			function detailSupportInit($scope, $compile){
				return new detailSupport($scope, $compile);
			};
			function detailSupport($scope, $compile){
				this.$scope = $scope;
				this.$compile = $compile;
			};
			detailSupport.fn = detailSupport.prototype;
			detailSupport.fn.init = function(data){
				this.entity = data;
				this.entity.levelName = this.$scope.cache.typeMap.get(this.entity.level);
				this.bind = {
					images: new Array()
				}
			};
			detailSupport.fn.digest = function(){
				 this.$scope.$digest();
			};
			detailSupport.fn.run = function(data) {
				var _this = this;
				_this.init(data);
				this.slidebars = Slidebar({
					size : 'lg',
					url : getServer()
							+ "/static/app/hotel/searchHotelInfos/views/detail.html",
					$scope: this.$scope,
					$compile: this.$compile,
					afterLoad : function($Panel) {
						_this.initialization();
					}
				});
			};
			detailSupport.fn.initialization = function(){
				this.baseInit();
			};
			
			detailSupport.fn.baseInit = function() {
				var _this = this;
				$.ajax({
					url : getServer() + "/flea/hclv/address/findByHotelId.htmls",
					data:{'hotelId': _this.entity.id},
					success : function(data) {
						data = data.data;
						_this.entity.province = data.province;
						_this.entity.provinceName = _this.$scope.cache.provinceMap.get(data.province);
						_this.entity.city = data.city;
						_this.entity.area = data.area;
						_this.entity.detail = data.detail;
						_this.getCity();
						_this.getZone();
					}
				});
				$.ajax({
					url : getServer() + "/flea/hclv/resRelation/getFilePathByUuid.htmls",
					data:{'uuid': _this.entity.id},
					success : function(data) {
						var rows = data, len = rows.length;
						
						for(var i = 0; i < len; i++){
							_this.bind.images.push($.extend(rows[i], {
								path: Properties.URL_FILE_SERVER_URL + rows[i].path
							}));
						}
						_this.digest();
					}
				});
			};
			detailSupport.fn.getCity = function() {
				var _this = this;
				$.ajax({
					url : getServer() + "/flea/hclv/getCity.htmls",
					 data:{'pcode': _this.entity.province},
					success : function(data) {
						var data = data.data, len = data.length;
	                    for(var i = 0; i < len; i++){
	                    	if(data[i].dictCode == _this.entity.city){
	                    		_this.entity.cityName = data[i].dictName;
	                    	}
	                    }
	                    _this.digest();
					}
				});
			};
			detailSupport.fn.getZone = function() {
				var _this = this;
				$.ajax({
					url : getServer() + "/flea/hclv/getZone.htmls",
					data:{'pcode': _this.entity.city},
					success : function(data) {
						var data = data.data, len = data.length;
	                    for(var i = 0; i < len; i++){
	                    	if(data[i].dictCode == _this.entity.area){
	                    		_this.entity.areaName = data[i].dictName;
	                    	}
	                    }
	                    _this.digest();
					}
				});
			}
			return detailSupportInit;
		});